var express = require('express');
var router = express.Router();

/* GET home page. */
router.get('/', function(req, res, next) {
  res.render('index', { title: 'Express' });
});

router.get('/goods',function(req,res){
  console.log(req.query);

  res.send('商品列表内容');
});

router.get('/product/:id',function(req,res){
  console.log(req.params.id);
  let id = req.params.id;
  if(id == '1'){
    res.render('food1');
  }else if(id == '2'){
    res.render('food2');
  }else{
    res.send();
  }
   
});

module.exports = router;
